function base64ToFile (dataurl, filename) {
    var arr = dataurl.split(',');
    var mime = arr[0].match(/:(.*?);/)[1];
    var bstr = atob(arr[1]);
    var n = bstr.length;
    var u8arr = new Uint8Array(n);
    while (n--) {
        u8arr[n] = bstr.charCodeAt(n);
    }
    return new File([u8arr], filename, {type: mime});
}

function layerTips(type,img,text,url,url200,yesFun) {
    layer.open({
        type: 1
        , title: false //不显示标题栏
        , closeBtn: false
        , area: ['450px', '']
        , shade: 0.8
        , id: 'payCons' //设定一个id，防止重复弹出
        , moveType: 1 //拖拽模式，0或者1
        , shadeClose: true //设置允许点遮罩关闭
        , content: getLayerHtml(type,img,text),
        success: function () {
            let scope = $("#layerHtml");
            if(url){
                window.location.href = url;
            }
            $(".closeButton", $(scope)).on("click", function () {
                layer.closeAll();
                if(url200){
                    window.location.href = url200;
                }
            });

            $(".confirmButton",$(scope)).on("click",yesFun);
        },
    });
}

function success(data) {

}

function getLayerHtml(type,img,text) {
    if(type == "1" || type == 1) {
        return '<div class="popUp" id="layerHtml"><div class="delete-con"> <ul> <li><img src="'+img+'">提示：</li> <li class="f14px">'+text+'</li></ul> <div class="btn-con textRight pt15px cursor"> <div class="inline-block textCenter overflow"><p class="confirm-con closeButton">确 定</p> </div> </div> </div></div>'
    }else if(type == "2" || type == 2) {
        return '<div class="popUp" id="layerHtml"><div class="delete-con"> <ul> <li><img style="width: 22px" src="'+img+'">警告：</li> <li class="f14px">'+text+'</li></ul> <div class="btn-con textRight pt15px cursor"> <div class="inline-block textCenter overflow"> <p class="confirm-cancel mr20px closeButton">取 消</p><p class="confirm-con confirmButton">确 定</p> </div> </div> </div></div>'
    }
}